# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-ua-parser
_pyname=ua-parser
pkgver=0.18.0
_uapcorever=0.18.0
pkgrel=1
arch="noarch"
pkgdesc="Python port of Browserscope's user agent parser"
url="https://pypi.python.org/project/ua-parser"
license="Apache-2.0"
depends="
	py3-pyaml
	"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
	"
checkdepends="
	py3-pytest
	"
source="
	$pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/u/ua-parser/ua-parser-$pkgver.tar.gz
	$pkgname-core-$_uapcorever.tar.gz::https://github.com/ua-parser/uap-core/archive/refs/tags/v$_uapcorever.tar.gz
	"
builddir="$srcdir"/$_pyname-$pkgver
subpackages="$pkgname-pyc"

prepare() {
	default_prepare
	ln -s "$srcdir"/uap-core-$_uapcorever "$builddir"/uap-core
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
1b3685df8fc65f529b3a54d7bc56aa6d2df56e028d3a2fd2206826119c1ccabe2aaf7dd4c2c00122a0189c0987360a6d7af12ec2dac444b55cf745ebfc7365fd  py3-ua-parser-0.18.0.tar.gz
78cf77d38e5738651060d194c94cd5c6e514e4fd01da121250d016bbe6a8967e0c56a91ae26117832c11aa50d9afec8ac06fe7a7568a55bf7098ff21bc279567  py3-ua-parser-core-0.18.0.tar.gz
"
